import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SPoint } from "./SPoint";
//class SeqPointHelper

export class SeqPointHelper {
  public static write(arg1: SerializeStream, arg2: Array<SPoint>): void {
    var i = 0;
    if (arg2 != null) {
      arg1.writeSize(arg2.length);
      i = 0;
      while (i < arg2.length) {
        arg2[i].__write(arg1);
        ++i;
      }
    } else {
      arg1.writeSize(0);
    }
    return;
  }

  public static read(arg1: SerializeStream) {
    var loc2 = arg1.readSize();
    arg1.checkFixedSeq(loc2, 4);
    var ret = new Array<SPoint>();
    var i = 0;
    while (i < loc2) {
      let p = new SPoint();
      p.__read(arg1);
      ret[i] = p;
      ++i;
    }
    return ret;
  }
}
